<?php
/**
 * Created by lzl
 * Date: 2021 2021/11/18
 * Time: 9:39
 */
namespace App\Http\Controllers\Api;

use App\Models\PartnerOrder;
use App\Services\Api\PartnerServices;
use App\Services\Api\PaymentService;

class PartnerController extends Controller
{


    /**
     * 提交订单
     * @return mixed
     * @throws \EasyWeChat\Kernel\Exceptions\InvalidArgumentException
     * @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException
     * @throws \GuzzleHttp\Exception\GuzzleException
     */
    public function orderSubmit()
    {
        return $this->success(PartnerServices::submitOrder());
    }


    /**
     * @throws \EasyWeChat\Kernel\Exceptions\Exception
     */
    public function orderNotify()
    {
        return (new PaymentService())->notify(new PartnerOrder());
    }


    /**
     * 我的团队
     * @return mixed
     * @throws \App\Exceptions\RequestException
     */
    public function myTeam()
    {
        $rules = [
            'page' => 'required|integer',
            'limit' => 'required|integer',
        ];

        $this->validateInput($rules);

        return $this->successOrNodata((new PartnerServices())->teamList($this->validated));
    }

    /**
     * @return mixed
     */
    public function index()
    {
        return $this->success(PartnerServices::getAmount());
    }


    public function teamDetail()
    {

    }

}